﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Configuration;

/// <summary>
/// Summary description for D_Company
/// </summary>
namespace Bestlife.ERP.DataAccess
{
    public class D_Company
    {
        public D_Company()
        {
            //
            // TODO: Add constructor logic here
            //
        }
        public static int addTenant(Bestlife.ERP.Entities.E_Company com)
        {
            SqlConnection conn_new = new SqlConnection();
            int status = 0;
            try
            {
                String connStr = ConfigurationManager.ConnectionStrings["MainConnStr"].ConnectionString;
                Bestlife.ERP.DataAccess.clsCon.connect(connStr);

                com.Sup_Id1 = "001";
             
                //String Ssql = "INSERT INTO Tbl_Distributor(Dis_ID,Sup_ID,Title,Giv_Name,Sur_Name,Che_Name,Address1,Address2,City,Province,Zip_Code,Hom_Tel_No,Mob_No,Email,Occupation,Bussiness_NameAdd,Office_Tel,ID_No,Nationality,Dob,Beneficiary,Ben_Add,Ben_Rel,Nominee,Nom_Add,Nom_Rel,Sec_Question,Answer,Sec_Word,Qa_Pin,Pas_Word,Web_Url,Ship_Contact,Ship_Address1,Ship_Address2,Ship_City,Ship_Province,Ship_Zip_Code,Ship_Country,Ship_Hom_Tel_No,Ship_Mob_No,Ship_Email)VALUES('" + reg.Dis_Id1 + "','" + reg.Sup_ID1 + "','" + reg.Title1 + "','" + reg.Giv_Name1 + "','" + reg.Sur_Name1 + "','" + reg.Che_Name1 + "','" + reg.Address11 + "','" + reg.Address21 + "','" + reg.City1 + "','" + reg.Province1 + "','" + reg.Zip_Code1 + "','" + reg.Home_Tel_No1 + "','" + reg.Mob_No1 + "','" + reg.Email1 + "','" + reg.Occupation1 + "','" + reg.Business_NameAdd1 + "','" + reg.Office_Tel1 + "','" + reg.Valid_Id1 + "','" + reg.Nationality1 + "','" + reg.Dob1 + "','" + reg.Beneficiary1 + "','" + reg.Ben_Add1 + "','" + reg.Ben_Rel1 + "','" + reg.Nominee1 + "','" + reg.Nom_Add1 + "','" + reg.Nom_Rel1 + "','" + reg.Sec_Question1 + "','" + reg.Answer1 + "','" + reg.Sec_Word1 + "','" + reg.Qa_Pin1 + "','" + reg.Pas_Word1 + "','" + reg.Web_Url1 + "','" + reg.Ship_Contact1 + "','" + reg.Ship_Address11 + "','" + reg.Ship_Address21 + "','" + reg.Ship_City1 + "','" + reg.Ship_Province1 + "','" + reg.Ship_Zip_Code1 + "','" + reg.Ship_Country1 + "','" + reg.Ship_Hom_Tel_No1 + "','" + reg.Ship_Mob_No1 + "','" + reg.Ship_Email1 + "')";
                String Ssql = "INSERT INTO Tbl_Distributor(Dis_ID,Sup_ID,Giv_Name,Sur_Name,Che_Name,Address1,Address2,City,Province,Zip_Code,Hom_Tel_No,Mob_No,Email,Bussiness_NameAdd,ID_No,Reg_Date,Reg_Country,Ship_Contact,Ship_Address1,Ship_Address2,Ship_City,Ship_Province,Ship_Zip_Code,Ship_Hom_Tel_No,Ship_Mob_No,Ship_Email,Perf_Language,Sec_Word,Qa_Pin,Pas_Word,Web_Url,Com_Status)VALUES('" + com.Dis_Id1 + "','"+com.Sup_Id1+"','" + com.Company_Name1 + "','" + com.Contact_Person1 + "','" + com.Che_Name1 + "','" + com.Address11 + "','" + com.Address21 + "','" + com.Town1 + "','" + com.State1 + "','" + com.Zip_Code1 + "','" + com.Home_Phone1 + "','" + com.Mobile_Phone_No1 + "','" + com.Email1 + "','" + com.Type_Of_Bussiness1 + "','" + com.Valid_Id1 + "','" + com.Reg_Date1 + "','" + com.Reg_Country1 + "','" + com.Ship_Contact1 + "','" + com.Ship_Address11 + "','" + com.Ship_Address21 + "','" + com.Ship_Town1 + "','" + com.Ship_State1 + "','" + com.Ship_Zip_Code1 + "','" + com.Ship_Phone1 + "','" + com.Ship_Mobile1 + "','" + com.Ship_Email1 + "','" + com.Language1 + "','" + com.Security_Word1 + "','" + com.BCrown_Pin1 + "','" + com.Password1 + "','" + com.URL1 + "','"+com.Company_Status1+"')";
                Boolean exec = Bestlife.ERP.DataAccess.clsCon.AddEditDel(Ssql);
            }
            catch (Exception)
            {
                // Console.WriteLine(exx);
            }
            return status;
        }
    }
}